<template>
  <div class="NoveCarousel">
    <div class="db-outer">
      <div class="db-middle">
        <!-- 小说轮播一楼 -->
        <div class="db-floor d-flex justify-content-between">
          <h2 class="db-floor-h2">完本推荐</h2>
          <!-- 第一页轮播 -->
          <div
            id="first-carousel"
            class="carousel slide db-ring"
            data-touch="false"
            data-interval="false"
          >
            <div class="carousel-inner">
              <div class="carousel-item active">
                <div class="d-flex">
                  <div class="db-books d-flex" v-for="(item,i) of channelend" :key="i">
                    <!-- 书的封面 -->
                    <div class="book-cover1">
                      <a href="#" class="d-block book-cover"
                        ><img :src="item.imgPath" alt="" class="db-book-img"
                      /></a>
                    </div>
                    <!-- 书本详情 -->
                    <div class="db-info float-right">
                      <!-- 书名 -->
                      <a href="#" class="info-a d-block"
                        ><span class="floot-span1">{{ item.book_name }}</span></a
                      >
                      <!-- 作者 -->
                      <a href="#" class="info-a d-block"
                        ><span class="floot-span2">{{ item.writer }}</span></a
                      >
                      <!-- 书本介绍 -->
                      <div class="db-abstract">
                        {{ item.info }}
                      </div>
                      <a href="#" class="db-romance">现代言情</a>
                    </div>
                  </div>
                </div>
              </div>
              <div
                v-for="(ele, index) of arr1"
                :key="index"
                class="carousel-item"
              >
                <div class="d-flex">
                  <div class="db-books d-flex" v-for="(p,i) of channelend2" :key="i">
                    <!-- 书的封面 -->
                    <div class="book-cover1">
                      <a href="#" class="d-block book-cover"
                        ><img :src="p.imgPath" alt="" class="db-book-img"
                      /></a>
                    </div>
                    <!-- 书本详情 -->
                    <div class="db-info float-right">
                      <!-- 书名 -->
                      <a href="#" class="info-a d-block"
                        ><span class="floot-span1">{{ p.book_name }}</span></a
                      >
                      <!-- 作者 -->
                      <a href="#" class="info-a d-block"
                        ><span class="floot-span2">{{ p.writer }}</span></a
                      >
                      <!-- 书本介绍 -->
                      <div class="db-abstract">
                        {{ p.info }}
                      </div>
                      <a href="#" class="db-crime d-inline-block">复仇计划</a>
                      <a href="#" class="db-crime d-inline-block">罪案故事</a>
                    </div>
                  </div>

                </div>
              </div>
            </div>
            <button
              class="carousel-control-prev db-btn1 position-absolute"
              type="button"
              data-target="#first-carousel"
              data-slide="prev"
            >
              <span
                class="carousel-control-prev-icon db-arrow"
                aria-hidden="true"
              ></span>
              <span class="sr-only">Previous</span>
            </button>
            <button
              class="carousel-control-next db-btn2 position-absolute"
              type="button"
              data-target="#first-carousel"
              data-slide="next"
            >
              <span
                class="carousel-control-next-icon db-arrow"
                aria-hidden="true"
              ></span>
              <span class="sr-only">Next</span>
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      src: "./image/books/1_1.jpg",
      arr1: [1, 2],
    };
  },
  props: ["channelend", "channelend2"],
};
</script>

<style lang="scss">
.book-cover1 {
  position: relative;
  margin-bottom: 10px;
  .book-cover:hover::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 110px;
    height: 165px;
    background-color: rgba(0, 0, 0, 0.15);
  }
}
.book-cover2 {
  position: relative;
  margin-bottom: 10px;
  .book-cover3:hover::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 120px;
    height: 180px;
    background-color: rgba(0, 0, 0, 0.15);
  }
  .book-cover3 {
    img {
      width: 120px;
      height: 180px;
    }
  }
}
// 小说轮播楼
.db-outer {
  width: 100%;
  background-color: #fff;

  .db-middle {
    width: 100%;
    min-width: 1320px;
    margin: 0 auto;

    .db-floor::before {
      content: "";
      display: table;
      height: 0;
    }

    .db-floor {
      position: relative;
      width: 1200px;
      margin: 0 auto;
      padding-top: 10px;
      box-sizing: content-box;
      margin-right: auto;
      margin-left: auto;
      padding-right: 60px;
      padding-left: 60px;

      .db-floor-h2 {
        position: absolute;
        top: 0;
        padding: 8px 12px;
        border-radius: 0 0 2px 2px;
        background: #bb996d;
        color: #fff;
        font-size: 14px;
        line-height: 1;
      }

      .db-books {
        width: 600px;
        height: 205px;
        margin-top: 50px;
        padding: 20px;
      }

      .db-info {
        margin-left: 20px;

        // position: relative;
        .info-a {
          text-decoration: none;
        }

        .floot-span1 {
          color: #333;
          font-size: 20px;
          font-weight: bold;
        }

        .floot-span2 {
          color: #777;
          font-size: 10px;
        }

        .db-abstract {
          position: relative;
          margin: 20px 30px 0 0;
          padding: 4px 15px;
          font-size: 14px;
          color: #333;

          &::after,
          &::before {
            content: "";
            position: absolute;
            width: 10px;
            height: 10px;
          }

          &::before {
            left: 0;
            top: 0;
            border-top: 1px solid rgb(166, 166, 166);
            border-left: 1px solid rgb(166, 166, 166);
          }

          &::after {
            right: 0;
            bottom: 0;
            border-bottom: 1px solid rgb(166, 166, 166);
            border-right: 1px solid rgb(166, 166, 166);
          }
        }
      }
    }
  }
}
//轮播小说介绍
.box-span3 {
  font-size: 13px;
  color: #333;
  line-height: 1.5;
  word-break: break-word;
  margin-top: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  /* 兼容性 */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
//言情.悬疑小字的样式
.db-aa {
  font-size: 12px;
  line-height: 16px;
  color: #777;
}
.db-aa:hover {
  color: rgb(36, 180, 206);
}
.db-book-img {
  width: 110px;
  height: 165px;
  margin-right: 0;
  border-radius: 4px;
  box-shadow: 2px 1px 15px 0 #777;
}
.db-romance {
  padding: 2px 3px;
  margin-top: 20px;
  font-size: 12px;
  text-decoration: none;
  color: #fff;
  background: #F26C98;
}
.db-crime {
  padding: 2px 3px;
  font-size: 12px;
  border-radius: 0 2px 2px 2px;
  text-decoration: none;
  color: #fff;
  background: #7565B5;
}
.db-ring .db-btn1 {
  left: -150px;
}

.db-ring .db-btn2 {
  right: -150px;
}

.db-ring:hover>button {
  background-color: #389eac;
}

.db-middle:hover .db-btn1 {
  transform: translate(100px, 0);
}

.db-middle:hover .db-btn2 {
  transform: translate(-100px, 0);
}

.db-middle:hover button {
  transition: 0.5s linear;
}
.db-ring {
  position: relative;
}

.db-ring button {
  position: absolute;
  margin-top: 130px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: rgba(56, 158, 172, 0);
  transform: translate(0, 0);
}
</style>
